import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';

// 模型加载器模块 - 专门处理3D模型加载逻辑
export class ModelLoader {
    constructor() {
        this.loader = new GLTFLoader();
    }

    loadModel(path, scene, onLoad = () => {}, onError = (error) => console.error(error)) {
        this.loader.load(
            path,
            (gltf) => {
                scene.add(gltf.scene);
                onLoad(gltf);
            },
            undefined,
            (error) => {
                onError(error);
            }
        );
    }
}